<?php

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\BackendAsset;

/**
 * @var \yii\web\View $this
 * @var string $content
 */
BackendAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
    <head>
        <meta charset="<?= Yii::$app->charset ?>"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title><?= Html::encode($this->title) ?></title>
        <?php $this->head() ?>
    </head>
    <body>

        <?php $this->beginBody() ?>
        <div class="wrap">
            <?php
            NavBar::begin([
                'id' => 'top-nav',
                'brandLabel' => Yii::$app->name,
                'brandUrl' => Yii::$app->homeUrl,
                'innerContainerOptions' => ['class' => 'container-fluid'],
                'options' => [
                    'class' => 'navbar-inverse navbar-fixed-top',
                ],
            ]);
            echo Nav::widget([
                'options' => ['class' => 'navbar-nav navbar-main'],
                'items' => [
                    ['label' => '首页', 'url' => ['/dashboard'],],
                    ['label' => '分类管理', 'url' => ['/category'], 'active' => Yii::$app->controller->module->id == 'category' ? TRUE : FALSE, 'items' => [
                            ['label' => '所有分类', 'url' => ['/category/category/index']],
                            ['label' => '新增分类', 'url' => ['/category/category/create']],
                            ['label' => '所有类别', 'url' => ['/category/type/index']],
                            ['label' => '新增类别', 'url' => ['/category/type/create']],
                        ],
                    ],
                ],
            ]);
            echo Nav::widget([
                'options' => ['class' => 'navbar-nav navbar-right'],
                'items' => [
                    ['label' => '回到前台', 'url' => Yii::$app->urlManagerFrontend->createUrl('/dashboard')],
                    ['label' => '退出 (' . Yii::$app->user->identity->username . ')', 'url' => ['/user/user/logout']],
                ],
            ]);
            NavBar::end();
            ?>
            <div class="container-fluid">
                <?=
                Breadcrumbs::widget([
                    'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
                ])
                ?>
                <?= $content ?>
            </div>
        </div>

        <footer class="footer">
            <div class="container-fluid">
                <p class="pull-left">&copy; My Company <?= date('Y') ?></p>
                <p class="pull-right"><?= Yii::powered() ?></p>
            </div>
        </footer>

        <?php $this->endBody() ?>
    </body>
</html>
<?php $this->endPage() ?>
